package com.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.model.Usr;
import com.service.UsrServiceI;

@Controller
@RequestMapping("/usrController")
public class UsrController {
	
	private UsrServiceI usrService;
	
	public UsrServiceI getUsrService() {
		return usrService;
	}

	@Autowired
	public void setUsrService(UsrServiceI usrService) {
		this.usrService = usrService;
	}

	@ResponseBody
	@RequestMapping("/showUsr")
	public String showUsr(String id,HttpServletRequest request){
		
		Usr usr=usrService.getUsrById(Integer.valueOf(id));
		return JSON.toJSONString(usr);
	}
}
